<?php
defined("_VALID_ACCESS") || die('Direct access forbidden');
    class Eyeworx_Inventory_Accessories_RBO_RBOAccessories extends RBO_Recordset {

//        public function display_total($record, $nolink = false){
//            $total = $record->compute_total();
//            $price_currency =  Utils_CurrencyFieldCommon::get_values($record->total);
//            return Utils_CurrencyFieldCommon::format(round($total,2),$price_currency[1]);
//        }

        public function fields() {
            $fields = array();

            $brand = new RBO_Field_Text('Accessory Name');
            $brand->set_length(45)->set_visible()->set_required();
            $fields[] = $brand;

            $brand = new RBO_Field_Text('Accessory Brand');
            $brand->set_length(45)->set_visible()->set_required();
            $fields[] = $brand;

            $model = new RBO_Field_Text('Accessory Model');
            $model->set_length(45)->set_required()->set_visible();
            $fields[] = $model;

            $color = new RBO_Field_MultiSelect('Accessory Color', 'eyeworx_color', array('color_name'));
            $color->set_filter()->set_visible();
            $fields[] = $color;

            $price = new RBO_Field_Currency('Price per Qty');
            $price->set_required()->set_visible();
            $fields[] = $price;

            $qty = new RBO_Field_Integer('Total Qty');
            $fields[] = $qty;

            return $fields;
        }

        public function table_name() {
            return 'eyeworx_accessories';
        }

    }
?>